﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.MachineSys.MarketModel
{
    public partial class MBaoYangEdit : PageBase
    {
        protected override string DWZRef
        {
            get
            {
                return "MBaoYangListEasyUI";
            }
        }

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.修改 };
            }
        }

        protected int ID
        {
            get {
                return GetRequestValue<int>("ID", 0);
            }
        }

        private MBaoYangInfo _obj = null;
        protected MBaoYangInfo obj
        {
            get
            {
                if (ID > 0)
                {
                    if (_obj == null)
                    {
                        _obj = MBaoYangController.GetByID(ID);
                    }
                }
                else
                    _obj = new MBaoYangInfo();
                return _obj;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "edit")
            {
                addmenu();

            }
        }
        private void addmenu()
        {
            MBaoYangInfo obj = Request.SerializableObject<MBaoYangInfo>();
            if (obj.ZSYY == "展会政策")
            {
                obj.BB_ZHHTH = obj.ZH_RQ + " " + obj.ZH_DD;
            }
            else
            {
                obj.BB_ZHHTH = obj.QT_XSHTH;
            }
            //判断是否已存在,已申请过

            bool id = MBaoYangController.Update(obj);
            if (id)
            {
                SuccessJson("成功修改");
            }
            else
            {

                ErrorJson("修改失败");
            }

        }
    }
}